Patent Literature 1 describes a method for controlling a motor wherein the moment of inertia and the unbalance torque of a tool magazine are estimated based on the shapes and the distribution of the tools mounted to the tool magazine, and the optimum acceleration is determined by adding/subtracting the unbalance torque.